'''
读取配置
'''

import configparser
from typing import Any, Dict

class ConfigManage(object):
    def __init__(self,config_path):
        self.config = configparser.ConfigParser()
        self.config.read(config_path)
        self.config_path = config_path

    def get_value(self, section: str, key: str):

        if not self.config.has_section(section):
            return None

        if not self.config.has_option(section, key):
            return None

        value = self.config.get(section, key)

        return value

    def get_section(self, section: str) -> Dict[str, Any]:

        if not self.config.has_section(section):
            return {}

        return dict(self.config.items(section))